home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / comm2 / zpont311.lha / zpoint-3.11 / Rexx / tinyhelp.zprx < prev    next >
Text File  |  1995-03-09  |  7KB  |  320 lines

  1. /*
  2.    TinyHelp.zp 2.0 (6.2.94) by Ueli Kaufmann
  3.    ARexx Skript für Zodiac's Point
  4.  
  5. Zweck:
  6. ------
  7.    Zeigt eine Uebersicht der zur Zeit installierten ARexx-Skripten
  8.    und bietet die Moeglichkeit, sie per Mausklick zu starten..
  9.  
  10.  
  11. Hinweis:
  12. --------
  13.  - benoetigt die apig.library v3.3 von fish 634.
  14.  
  15.  
  16. Installation:
  17. -------------
  18. Ins fkeys.zp einbinden mit folgender Zeile:
  19.   F10:SYS:Rexxc/RX ZP:Rexx/TinyHelp.zp %s
  20. */
  21.  
  22.  
  23. parse arg zpPort
  24. address value zpPort
  25.  
  26.  
  27. /* benoetigte Libraries laden */
  28. if(~show('l',"rexxsupport.library")) then
  29.    x = addlib("rexxsupport.library",0,-30,0)
  30.  
  31. if(~show('l',"apig.library")) then
  32.    x = addlib("apig.library",0,-30,0)
  33.  
  34.  
  35.  /* apig vorbereiten */
  36. call Set_APIG_Globals()
  37.  
  38.  
  39. screen       = LockPubScreen("ZPoint")      /* gonna put our window  */
  40.                                             /* upon ZPoint screen    */
  41.  
  42. scrvinfo    = GetVisualInfo(screen)        /* NewGadgets need this  */
  43.  
  44. scrfont     = GETVALUE(screen,40,4,'p')    /* NewGadgets need this  */
  45.                                            /* points to TextAttr    */
  46.  
  47. glist       = AllocVec(4,MEMF_CLEAR)       /* a pointer for context */
  48.  
  49. conxgad     = CreateContext(glist)
  50. prevGadget  = conxgad
  51.  
  52.  
  53. /* Adressen Listview-Gadget */
  54.  
  55. newgadx = MakeNewGadget(scrvinfo,scrfont,8,16,508,120,null(),
  56.           ,null(),1,null())
  57.  
  58. if newgadx == null() then
  59.    exit(0)
  60.  
  61. rxList = build_rx_list()
  62.  
  63. prevGadget = CreateGadget(LISTVIEW_KIND,prevGadget,newgadx,
  64.                          ,GTLV_Labels, rxList,
  65.                          ,TAG_DONE,0)
  66.  
  67. /****************************/
  68.  
  69.  
  70. call FreeThis(newgadx)  /* NewGadget-Struktur Speicher freigeben */
  71.  
  72.  
  73. window = open_window()
  74. if window = null() then
  75. do
  76.    REQUESTNOTIFY "Requester konnte nicht geöffnet werden.."
  77.    exit(10)
  78. end
  79.  
  80. OPTIONS FAILAT 6     /* ignore warnings */
  81.  
  82. SIGNAL ON SYNTAX     /* ensure clean exit */
  83.  
  84. exitme = 0
  85. do while exitme = 0
  86.  
  87.    x = waitpkt(portname)
  88.    do forever 
  89.       msg = getpkt(portname)
  90.       if msg = '0000 0000'x
  91.          then leave
  92.  
  93.       msgclass  = getarg(msg,0)
  94.       msgcode  = getarg(msg,1)
  95.       msggadadr= getarg(msg,8)
  96.       msggadid  = getarg(msg,9)
  97.       x = reply(msg,0)  
  98.  
  99.       select
  100.          when msgclass = CLOSEWINDOW then    /* Close-Gadget */
  101.          do
  102.             exitme = 1
  103.          end
  104.  
  105.          when msgclass = NEWSIZE then        /* Zoom-Gadget */
  106.          do
  107.             zoomed = (zoomed = 0)
  108.             if zoomed == 0 then              /* Gadgets refreshen */
  109.                call GT_RefreshWindow(window)
  110.          end
  111.  
  112.          when msgclass = GADGETUP then       /* Gadget-UP */
  113.          do
  114.             if msggadid = 1 then
  115.             do
  116.                dummy = msgcode + 1
  117.                fnode = rxList
  118.                do x = 1 to dummy
  119.                    fnode = next(fnode)
  120.                end
  121.  
  122.                theCmd = GETVALUE(fnode,10,4,'s')   /* F-Taste rausschneiden */
  123.                cpos   = pos(':',theCmd)
  124.                if cpos ~= 0 then
  125.                     theCmd = delstr(theCmd, 1, cpos)
  126.  
  127.                cpos = pos('%s',theCmd)  /* ZP-Port anhängen */
  128.                if cpos ~= 0 then
  129.                do
  130.                        theCmd = delstr(theCmd, cpos)
  131.                     theCmd = theCmd || zpPort
  132.                end
  133.  
  134.                address command theCmd
  135.             end
  136.          end
  137.  
  138.          otherwise
  139.            nop
  140.       end
  141.    end
  142. end
  143.  
  144.  
  145. /**********************************/
  146.  
  147. SYNTAX:
  148.  
  149. dummy = close_window()
  150.  
  151. call FreeVisualInfo(scrvinfo)
  152.  
  153. call FREE_EXEC_LIST(rxList)
  154.  
  155. exit(0)
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165. /*****************************************************************/
  166.  
  167. open_window:
  168. wintitle = "ZP's little helper"
  169. winidcmp = CLOSEWINDOW+NEWSIZE+LISTVIEWIDCMP
  170. winflags = WINDOWCLOSE+WINDOWDRAG+WINDOWDEPTH+ACTIVATE
  171.  
  172. portname = "ZPOINT_HELP"
  173.  
  174. p = openport(portname)
  175.  
  176. myTitle  = 0
  177. tagList  = 0
  178. window   = 0
  179. zoomed   = 0
  180. if build_zoom_array() | build_window_name() then
  181. do
  182.    tagList = AllocateTagItems(13)
  183.    if tagList ~= null() then
  184.    do
  185.       call SetTagSlot(tagList,0,WA_LEFT,'n',114)
  186.  
  187.       call SetTagSlot(tagList,1,WA_TOP,'n',2)
  188.  
  189.       call SetTagSlot(tagList,2,WA_WIDTH,'n',524)
  190.  
  191.       call SetTagSlot(tagList,3,WA_HEIGHT,'n',138)
  192.  
  193.       call SetTagSlot(tagList,4,WA_DRAGBAR,'n',1) 
  194.  
  195.       call SetTagSlot(tagList,5,WA_CLOSEGADGET,'n',1) 
  196.  
  197.       call SetTagSlot(tagList,6,WA_ACTIVATE,'n',1) 
  198.  
  199.       call SetTagSlot(tagList,7,WA_TITLE,'p',myTitle)
  200.  
  201.       call SetTagSlot(tagList,8,WA_FLAGS,'n',winflags)
  202.  
  203.       call SetTagSlot(tagList,9,WA_ZOOM,'p',zoomArray)
  204.  
  205.       call SetTagSlot(tagList,10,WA_IDCMP,'n',winidcmp)
  206.  
  207.       call SetTagSlot(tagList,11,WA_CUSTOMSCREEN,'p',screen)
  208.  
  209.       call SetTagSlot(tagList,12,TAG_DONE,'n',0)
  210.  
  211.       window = OpenWindowTagList(portname,null(),tagList)
  212.       if window ~= null() then
  213.       do
  214.         call AddGList(window, conxgad, -1, -1, null());
  215.         call RefreshGList(conxgad, window, null(), -1);
  216.          call GT_RefreshWindow(window)
  217.       end
  218.    end
  219. end
  220.  
  221. call UnlockPubScreen(null(),screen)
  222.  
  223. return(window)
  224.  
  225.  
  226.  
  227. close_window:
  228. if conxgad ~= null() then
  229. do
  230.    if window ~= null() then
  231.       call RemoveGList(window, conxgad, -1)
  232.  
  233.    call FreeGadgets(conxgad)
  234.    drop conxgad
  235. end
  236.  
  237. if glist ~= null() then
  238. do
  239.    call FreeVec(glist)
  240.    drop glist
  241. end
  242.  
  243. if window ~= null() then
  244. do
  245.    call CloseWindow(window)
  246.    drop window
  247. end
  248.  
  249. if tagList ~= null() then
  250. do
  251.    call FreeTagItems(tagList)
  252.    drop tagList
  253. end
  254.  
  255. if myTitle ~= null() then
  256. do
  257.    call FreeVec(myTitle)
  258.    drop myTitle
  259. end
  260.  
  261. if zoomArray ~= null() then
  262. do
  263.    call FreeVec(zoomArray)
  264.    drop zoomArray
  265. end
  266.  
  267. return(0)
  268.  
  269. /*****************************************************************/
  270.  
  271. build_rx_list:
  272. mylist = AllocMem(14,MEMF_CLEAR)  /* our list structure  */
  273.                                   /* always use ALLOCMEM */
  274.                                   /* so it can be freed  */
  275.                                   /* properly.           */
  276.  
  277. call NewList(mylist)
  278.  
  279. if ~open('infile',"ZP:fkeys.zp",read) then 
  280. do
  281.    REQUESTNOTIFY "fkeys.zp kann nicht geoeffnet werden.."
  282.    exit(0)
  283. end
  284.  
  285. instring = ''
  286. do forever
  287.    instring=readln('infile')
  288.    dummy = ADD_LIST_NODE(mylist,instring)
  289.    if eof('infile') then 
  290.       leave
  291. end
  292.  
  293. dummy = close('infile')
  294.  
  295. return mylist
  296.  
  297. /*****************************************************************/
  298.  
  299. build_zoom_array:
  300. zoomArray = AllocVec(16,MEMF_CLEAR)
  301. if zoomArray ~= null() then
  302. do
  303.    call export(zoomArray,'019f'x || '0011'x || '00e0'x || '000d'x)
  304.    return(1)
  305. end
  306. return(0)
  307.  
  308. /*****************************************************************/
  309.  
  310. build_window_name:
  311. myTitle = AllocVec(length(wintitle)+1,MEMF_CLEAR)
  312. if myTitle ~= null() then
  313. do
  314.    call export(myTitle,wintitle)
  315.    return(1)
  316. end
  317. return(0)
  318.  
  319. /*****************************************************************/
  320.